package com.xt;

import java.awt.Point;

/**
 * @author v_guiqtong
 * @version 1.0
 */
public enum ElementData {
    //手机号输入框
    PHONE(65,246,285,47),
    //验证码输入框
    CODE(65,308,197,40),
    //发送验证码按钮
    SEND_BUTTON(267,307,84,46),
    //勾选框
    CHECK_BOX(67,373,13,15),
    //确定按钮
    CONFIRM_BUTTON(146,426,117,42),
    //验证码图片
    VERIFICATION_PICTURE(25,303,362,180),
    //刷新按钮
    REFRESH(361,308,20,18),
    //提示语句
    TIPS(119,489,92,39),
    //答案
    ANSWER(206,490,103,41),
    //更换手机号按钮
    CHANGE_PHONE(280,72,108,22),
    //确定银行
    RECEIVE(115,452,202,63),
    //微信确定
    WECHAT_CONFIRM(86,459,118,31);
    private final int relativelyWide;

    private final int relativelyHigh;

    private final int width;

    private final int height;

    ElementData(int relativelyWide, int relativelyHigh, int width, int height) {
        this.relativelyWide = relativelyWide;
        this.relativelyHigh = relativelyHigh;
        this.width = width;
        this.height = height;
    }

    public Point getStartPoint(Element element) {
        int m = element.getWidth();
        int n = element.getHeight();
        int x = element.getX();
        int y = element.getY();
        return new Point(relativelyWide*m/414+x,relativelyHigh*n/780+y);
    }

    public int getWidth(Element element) {
        return width*element.getWidth()/414;
    }

    public int getHeight(Element element) {
        return height*element.getHeight()/780;
    }

    public Point getClickPoint(Element element) {
        Point startPoint = getStartPoint(element);
        int halfWidth =(int) (0.5*getWidth(element));
        int halfHeight =(int) (0.5*getHeight(element));
        return new Point((int) (startPoint.getX()+halfWidth), (int) (startPoint.getY()+halfHeight));
    }

}
